package com.hfzy.ihk.web.calldata.handlers;

import com.alibaba.fastjson.JSON;
import com.hfzy.ihk.common.constants.GlobalStatic;
import com.hfzy.ihk.common.core.elasticsearch.ElasticsearchOperation;
import com.hfzy.ihk.common.core.elasticsearch.OperationErrorMsgBiz;
import com.hfzy.ihk.common.core.elasticsearch.base.CommonTableOperationHandler;
import com.hfzy.ihk.common.util.string.StringTools;
import com.hfzy.ihk.common.web.WebResult;
import com.hfzy.ihk.facade.calldata.entity.CallTaskDetail;
import com.hfzy.ihk.facade.calldata.enums.CallDataOperations;
import com.hfzy.ihk.facade.calldata.enums.CallDataTables;
import com.hfzy.ihk.web.calldata.biz.CallTaskDetailBiz;
import com.hfzy.ihk.web.calldata.vo.CallTaskDetailTotalVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2018/9/5.
 */
@Component
public class CallTaskDetailTableOperationHandler extends CommonTableOperationHandler {

    private static final Logger logger = LoggerFactory.getLogger(CallTaskDetailTableOperationHandler.class);

    @Autowired
    private OperationErrorMsgBiz operationErrorMsgBiz;

    public CallTaskDetailTableOperationHandler() {

        /**
         * 必须定义该处理器对应的table和操作名
         * */
        this.table = CallDataTables.CALL_TASK_DETAIL;

        this.tableOperation = CallDataOperations.addCallTaskDetail;
    }

    @Override
    protected void toHandle(ElasticsearchOperation elasticsearchOperation) {

    }

    /***
     *
     * 表操作失败的处理
     * */
    public void handleError(ElasticsearchOperation elasticsearchOperation, Exception e) {

        if(elasticsearchOperation.isFromJobRun()){
            return;
        }

        logger.error("处理操作错误：",e);

        operationErrorMsgBiz.dealElasticsearchOperation(elasticsearchOperation,e);
    }
}
